$(function() {
	$('.company').on('click', function() {
		popup(this)
	})
	$('.delete-list').on('click',function(){
		popup(this,"{:url('delete')}");
		
	})
	
	$('.startusing').on('click',function(){
		popup(this,"{:url('state')}");
	})
	$('.forbidden').on('click',function(){
		popup(this,"{:url('state')}");
	})
	
	$('.company_name').on('click', function() {
		choosecar("{:url('company/index',['op'=>'search'])}");
	});
	//全选
	$('.check-all').on('click',function(){
		checkall(this)
	});
	$('.check-list').on('click',function(){
		checkall(this)
	});
	//删除多个
	$(".delete-multiple").on('click',function(){
		popup(this,"{:url('delete')}");
	});
	$('.choose').on('click',function(){
		{if $Think.get.is_check}
			var index = parent.layer.getFrameIndex(window.name);
			parent.$('.approval_name').val($(this).closest('tr').find('.name').html());
			parent.$('.approval_id').val($(this).closest('tr').data('id'));
			parent.layer.close(index);
		{else/}
			var that=this
			var choose = layer.open({
				type: 1,
				title:false,
				skin: 'layui-layer-rim', //加上边框
				area: ['200px', '100px'], //宽高
				content: `
				<div style='width:100%;height:100%;padding:0 10px'>
				  	<table style='width:100%;'>
				  		<tr>
					  		<td style='text-align:center'>
								<div class="tpl-table-black-operation">
									<a class="passenger" style='margin-top:30px'>
										设为乘客
									</a>
								</div>
							</td>
							<td style='text-align:center'>
								<div class="tpl-table-black-operation">
									<a class='orderer' style='margin-top:30px'>
										设为下单人
									</a>
								</div>
							</td>
							
						</tr>
					</table>
					
			  	</div>
			  `,
			  success:function(){
			  	var index = parent.layer.getFrameIndex(window.name);
				$('.passenger').on('click',function(){
					parent.$('.passenger_name').val($(that).closest('tr').find('.name').html());
					parent.$('.passenger_id').val($(that).closest('tr').data('id'));
					parent.$('.passenger_phone').val($(that).closest('tr').find('.phone').html());
					parent.layer.close(index);
				})
				$('.orderer').on('click',function(){
					parent.$('.orderer_name').val($(that).closest('tr').find('.name').html());
					parent.$('.orderer_id').val($(that).closest('tr').data('id'));
					parent.layer.close(index);
				})
				
				
			  }
			});
		{/if}
		
		
		
	})

    //查看订单弹窗
    $(".look_order").on('click', function() {
        choosecar("/admin/order/lookOrder?op=search&passenger_id="+$(this).data('id'))
    });
    //重置密码弹窗
    $(".resetpassword").on('click', function() {
        choosecar("/admin/passenger/resetpassword?passenger_id="+$(this).data('id'))
    });
})